//
//  SSDKPluginHttpUtil.h
//  SSDKPlugin-demo
//
//  Created by 涂俊 on 2017/7/5.
//  Copyright © 2017年 涂俊. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SSDKPluginHttpUtil : NSObject

+ (BOOL)isNetworkReachable;


//post请求(表单)，在异步线程回调
+ (void)postWithUrl:(NSString *)url
               data:(NSDictionary *)data
           delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;

//post请求(表单)，可设置重试次数，在异步线程回调
+ (void)postWithUrl:(NSString *)url
               data:(NSDictionary *)data
           delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate
              retry:(int) retryTimes;

//post请求(json)，在异步线程回调
+ (void)postJsonWithUrl:(NSString *)url
                   data:(NSDictionary *)data
               delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;

//post请求(json)，可设置重试次数，在异步线程回调
+ (void)postJsonWithUrl:(NSString *)url
                   data:(NSDictionary *)data
               delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate
                  retry:(int) retryTimes;

//get请求，在异步线程回调
+ (void)getWithUrl:(NSString *)url
              data:(NSDictionary *)data
          delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;

//get请求，可设置重试次数，在异步线程回调
+ (void)getWithUrl:(NSString *)url
              data:(NSDictionary *)data
          delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate
             retry:(int) retryTimes;

//delete请求，在异步线程回调
+ (void)delWithUrl:(NSString *)url
              data:(NSDictionary *)data
          delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;

//delete请求，可设置重试次数，在异步线程回调
+ (void)delWithUrl:(NSString *)url
              data:(NSDictionary *)data
          delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate
             retry:(int) retryTimes;




//post请求(表单)，在ui线程回调
+ (void)postUIWithUrl:(NSString *)url
                 data:(NSDictionary *)data
             delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;

//post请求(Json)，在ui线程回调
+ (void)postJsonUIWithUrl:(NSString *)url
                     data:(NSDictionary *)data
                 delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;


//get请求，在ui线程回调
+ (void)getUIWithUrl:(NSString *)url
                data:(NSDictionary *)data
            delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;

//delete请求，在ui线程回调
+ (void)delUIWithUrl:(NSString *)url
                data:(NSDictionary *)data
            delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate;


//自定义http请求，在异步线程回调
+ (void)dealWithRequest:(NSMutableURLRequest *)request
               delegate:(void (^)(BOOL networkAvaliable, NSInteger status, NSString* resData))delegate
                  retry:(int) retryTimes;

@end
